package com.xsjiong.je;

import java.util.Vector;

public class EInterface {
	private static int ID_COUNTER=0;
	public int ID;
	public EObject Parent;
	private Vector<EInterface> target = new Vector<>();
	public EInterface(EObject parent) {
		ID = ++ID_COUNTER;
		this.Parent=parent;
	}
	public void Connect(EInterface an) {
		if (target.contains(an)) return;
		target.add(an);
		an.target.add(this);
	}
	public void Disconnect(EInterface an) {
		if (target.remove(an)) an.target.remove(this);
	}
	public boolean Connected(EInterface an) {
		return target.contains(an);
	}
	public void Clear() {
		for (EInterface one : target)
			one.target.remove(this);
		target.clear();
	}
}
